<template>
  <div class="container with-nav-padding">
    <div class="user-info" :style="{background: mainColor}">
      <div class="user">
        <div class="avatar">
          <img :src="avatar" alt="" />
        </div>
        <div class="info">
          <div class="username">
            <span class="name">官方微信公众号</span>
          </div>
          <div class="other-info">
            <span class="expire">教你如何使用会员商城、快速入门</span>
          </div>
        </div>
      </div>
    </div>
    <div class="qrCode">
      <img :src="qrcode" alt="" />
      <div class="left_radiusIcon"></div>
      <div class="right_radiusIcon"></div>
    </div>
  </div>
</template>

<script>
import { getVipDetail } from "@/api/vip";
import { mapState } from 'vuex'
export default {
  data() {
    return {
      avatar: "",
      qrcode: ""
    };
  },
  computed: {
    ...mapState({
      entryUrl: state => state.app.entryUrl,
      logo: state => state.app.logo,
      isMiniProgram: state => state.app.isMiniProgram,
      isFullscreen: state => state.app.isFullscreen,
      mainColor: state => state.app.mainColor,
      vip_rigths: state => state.app.vip_rigths
    })
  },
  created() {
    getVipDetail({
      type: 3
    }).then(res => {
      if (res.status === 200) {
        this.avatar = res.data.data.avatar;
        this.qrcode = res.data.data.image;
      }
    });
  }
};
</script>

<style lang="less" scoped>
.container {
  .clear {
    clear: both;
  }

  .user-info {
    color: #f5f5f5;
    height: 7.12rem;
    background-color: rgb(6, 120, 255);
    padding: 0.9rem 3.2% 0.6rem;
    overflow: hidden;

    .top-icon {
      width: 1.5rem;
      text-align: center;
      height: 1.24rem;
      line-height: 1.24rem;
      right: 3.2%;
      top: 0.8rem;
      position: absolute;

      img {
        margin-top: 0.3rem;
        width: 55%;
      }
    }

    .user {
      display: flex;

      .avatar {
        height: 2rem;
        width: 2rem;
        border-radius: 50%;
        overflow: hidden;
        background-color: #dfdfdf;
        img {
          width: 100%;
          height: 100%;
        }
      }

      .info {
        margin-left: 0.52rem;
        width: calc(100% - 3rem);

        .username {
          .name {
            font-size: 0.64rem;
            margin-right: 0.8rem;
            font-weight: bold;
          }
        }

        .other-info {
          margin-top: 0.4rem;
          font-size: 0.52rem;

          .expire {
            margin-right: 6%;
          }
        }
      }
    }
  }

  .qrCode {
    position: relative;
    top: -3.26rem;
    left: calc(50% - 6.66rem);
    background: #ffffff;
    width: 13.32rem;
    height: 13.66rem;
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      // vertical-align: middle;
      height: 10rem;
      width: 10rem;
      object-fit: cover;
    }

    .left_radiusIcon {
      width: 1rem;
      height: 1rem;
      position: absolute;
      top: 2.24rem;
      left: -0.5rem;
      border-radius: 50%;
      background: rgb(6, 120, 255);
    }

    .right_radiusIcon {
      width: 1rem;
      height: 1rem;
      position: absolute;
      top: 2.24rem;
      right: -0.5rem;
      border-radius: 50%;
      background: rgb(6, 120, 255);
    }
  }
}
</style>
